package edu.gatech.oad.OTConfig;
/**
 * Item Class
 * @author Solace
 *
 */
public class Item {
	
	private String name;
	private int quantity;
	private int totalWeight;
	private final int WEIGHT_INDIVIDUAL;
	private int price;
	private final int BASE_PRICE;
	
	/**
	 * Constructor for the Item class
	 * @param name The item type
	 * @param quantity The item's quantity
	 * @param WEIGHT The item's weight
	 * @param PRICE The item's price
	 */
	public Item(String name, int quantity, int WEIGHT, int price){
		this.name=name;
		this.quantity=quantity;
		this.WEIGHT_INDIVIDUAL=WEIGHT;
		this.price=price;
		BASE_PRICE=price;
		calculateTotalWeight();
	}
	/**
	 * Calculates the total weight of a given item
	 */
	public void calculateTotalWeight(){
		totalWeight=quantity*WEIGHT_INDIVIDUAL;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the quantity
	 */
	public int getQuantity() {
		return quantity;
	}
	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}
	
	/**
	 * Checks if items are equal based on their names
	 * @param obj The item to check for equality
	 */
	public boolean equals(Object obj){
		Item item=(Item) obj;
		if (item.getName().equals(this.name)){
			return true;
		}
		return false;
	}

	/**
	 * Getter for WEIGHT_INDIVIDUAL
	 * @return the WEIGHT_INDIVIDUAL
	 */
	public int getWEIGHT_INDIVIDUAL() {
		return WEIGHT_INDIVIDUAL;
	}
	/**
	 * Getter for totalWeight
	 * @return the totalWeight
	 */
	public int getTotalWeight() {
		return totalWeight;
	}

	/**
	 * Setter for price
	 * @param price to be set
	 */
	public void setPrice(int price){
		this.price=price;
	}
	
	/**
	 * Getter for the price
	 * @return the price
	 */
	public int getPrice() {
		return price;
	}
	/**
	 * @return the bASE_PRICE
	 */
	public int getBASE_PRICE() {
		return BASE_PRICE;
	}
}
